import axios from '@/utils/axios';

// 获取药品分类列表
export const categoryList = (params) => {
  return axios({
    url: '/medicineCategories/list',
    method: 'get',
    params
  })

};



// 编辑药品分类
export const categoryEdit = (id, data) => {
  return axios.put(`/categories/${id}`, data);
};

// 删除药品分类
export const categoryDelete = (id) => {
  return axios({
    url: '/medicineCategories/delete/' + id,
    method: 'delete',
  })
};

// 获取子数据
export const getChildrenDate = (id) => {
  return axios({
    url: '/medicineCategories/getCategoryChildren/'+id,
    method: 'get',
  })
};
export const getChildrenDateTree = (params) => {
  return axios({
    url: '/medicineCategories/getCategoryChildrenTree',
    method: 'get',
    params
  })
};
// 获取所有第一级别的数据
export const getAllFirstLevel = () => {
  return axios({
    url: '/medicineCategories/getAllFirstLevel',
    method: 'get',
  })
};
// 获取所有第二级别的数据
export const fetchSecondLevel = (params) => {
  return axios({
    url: '/medicineCategories/getAllSecondLevel',
    method: 'get',
    params
  })
};
// 获取所有第三级别的数据
export const fetchThirdLevel = (params) => {
  return axios({
    url: '/medicineCategories/getAllThirdLevel',
    method: 'get',
    params
  })
};

// 添加药品分类
export const categoryAdd = (data) => {
  return axios({
    url: '/medicineCategories/addMedicineCategories',
    method: 'post',
    data
  })
};